/* ==================================================================   
 * Created [2009-4-27 下午11:32:55] by Jon.King 
 * ==================================================================  
 * TSS 
 * ================================================================== 
 * mailTo:jinpujun@hotmail.com
 * Copyright (c) Jon.King, 2009-2012 
 * ================================================================== 
 */

package com.jinhe.tss.cms.workflow;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.jinhe.tss.core.exception.BusinessException;
import com.jinhe.tss.core.persistence.ICommonDao;
 
public class WorkFlowServiceImpl implements WorkFlowService {
	
	@Autowired private ICommonDao siteDao;

	public boolean deleteWorkFlow(Integer code){
		List<?> list = siteDao.getEntities("from Channel c where c.workflowId=?", code);
		if( list.size() > 0 ) {
			throw new BusinessException("工作流已被使用,无法删除");
		}
        
        return WorkFlowManager.getInstance().deleteWorkFlow(code);
	}
}
